package com.iot.comprehensive.face.service.impl;

import com.iot.comprehensive.face.dao.RecordDao;
import com.iot.comprehensive.face.model.Record;
import com.iot.comprehensive.face.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 朱泽玉
 * @Create 2021/7/4 12:24
 * @Description
 * @Modified By:
 */
@Service
public class RecordServiceImpl implements RecordService {
    @Autowired
    final RecordDao recordDao;

    public RecordServiceImpl(RecordDao recordDao) {
        this.recordDao = recordDao;
    }

    @Override
    public void add(Record record) {
        recordDao.save(record);
    }

    @Override
    public List<Record> findAll() {
        return recordDao.findAll();
    }

    @Override
    public List<Record> findByAccount(Long account_id) {

        return recordDao.findByAccount(account_id);
    }

    @Override
    public List<Record> findByMethod(String method) {
        return recordDao.findByMethod(method);
    }

    @Override
    public Record findById(int id) {
        return recordDao.findById(id).orElse(null);
    }
}
